package com.young.springdemo.service.memento;

//原发器类
public class ChineseChess {

    private String label;
    private int x;
    private int y;

    public ChineseChess(String label, int x, int y) {
        this.label = label;
        this.x = x;
        this.y = y;
    }
    //恢复备忘录
    public void restore(ChineseChessMemento memento){
        this.label = memento.getLabel();
        this.x = memento.getX();
        this.y = memento.getY();
    }
    //保存备忘录
    public ChineseChessMemento save(){
        return new ChineseChessMemento(this.label,this.x,this.y);
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    @Override
    public String toString() {
        return "ChineseChess{" +
                "label='" + label + '\'' +
                ", x=" + x +
                ", y=" + y +
                '}';
    }
}
